/*
  according pointcloud output mode to publish different combination of
  pointcloud channel mode could be 1. normal, namely fusion for perception, top
  for ndt, surround for aeb
  2. calibration, only output channels for calibration
  3. other mode according to utilizations
*/
#ifndef _LIDAR_MOTION_PUBLISHER_H_
#define _LIDAR_MOTION_PUBLISHER_H_
#include "modules/common_msgs/sensor_msgs/pointcloud.pb.h"

#include "cyber/cyber.h"
#include "modules/drivers/lidar/orin_hesai/common/data_buffer.h"
#include "modules/drivers/lidar/orin_hesai/common/data_type.h"

using apollo::cyber::Node;
using apollo::cyber::Writer;
using apollo::drivers::PointCloud;

namespace apollo {
namespace drivers {
namespace lidar_hesai {
class LidarPublisher {
 public:
  bool Init(const std::string pc_channel, std::shared_ptr<Node> node,
            std::shared_ptr<CircularQueueBuffer<PointCloud>> frame_buffer,
            const std::string frame_id);
  void Write(std::shared_ptr<PointCloud>& frame);
  void Start();

 private:
  std::shared_ptr<Node> node_ = nullptr;
  std::shared_ptr<Writer<PointCloud>> writer_ = nullptr;
  std::string pc_channel_;
  std::shared_ptr<CircularQueueBuffer<PointCloud>> frame_buffer_;
  std::string frame_id_;
  std::shared_ptr<PointCloud> lidar_frame_ = nullptr;
};

}  // namespace lidar_hesai
}  // namespace drivers
}  // namespace apollo
#endif
